<div class="container">
	<ol class="breadcrumb">
		<li><?php echo anchor('', 'Início'); ?></li>
		<li><?php echo anchor('parasuaempresa', 'Para Sua Empresa'); ?></li>
		<li><?php echo anchor('parasuaempresa/pedidos', 'Pedidos'); ?></li>
		<li class="active">Visualização de pedido</li>
	</ol>
</div>

<div class="container">
	<div class="row">
		<?php $this->load->view('parasuaempresa/_sidebar'); ?>

		<div class="col-md-9 col-md-9">
			<h3 class="titulos">Pedido [<?php echo $pedido["geral"]->cod_pedido_auto; ?>]</h3>
			
			<div class="panel panel-default">
				<div class="panel-heading">Detalhes do pedido</div>
				<div class="panel-body">
					<div class="row">
						<div class="col-md-6">
							<strong>Cliente</strong><br />
							<?php echo $pedido["geral"]->cliente_nome; ?><br />
							<strong>E-mail</strong><br />
							<?php echo $pedido["geral"]->cliente_email; ?><br />
							<strong>Telefone</strong><br />
							<?php echo $pedido["geral"]->cliente_telefone; ?><br />
						</div>
						<div class="col-md-6">
							<div class="row">
								<div class="col-md-5">
									<strong>Valor itens</strong><br />
									R$ <?php echo number_format((float)$pedido["geral"]->pedido_total_itens, 2, ',', ''); ?>
								</div>
								<div class="col-md-2">
									+
								</div>
								<div class="col-md-5">
									<strong>Taxa de entrega</strong><br />
									R$ <?php echo number_format((int)$pedido["geral"]->pedido_taxa_entrega, 2, ',', ''); ?>		
								</div>
							</div>
							<div style="background:#f0f0f0; padding:15px; margin-top:10px; -webkit-border-radius:7px; border:1px solid #ccc;">
								<strong>Valor total</strong><br />
								R$ <?php echo number_format((float)$pedido["geral"]->pedido_total, 2, ',', ''); ?><br />
								<strong>Forma de pagamento</strong><br />
								<?php echo $pedido["geral"]->pedido_forma_pagto; ?>
							</div>							
						</div>
					</div>
				</div>
			</div>

			<div class="panel panel-default">
				<div class="panel-heading">Itens</div>
				<div class="panel-body">
				<table class="table">
					<thead>
						<tr>
							<th style="width: 20px;">#</th>
							<th>Item</th>
							<th  style="width: 80px;">Tam.</th>
							<th style="width: 80px;">Qtde</th>
							<th class="text-right" style="width:120px;">Vl Unitário</th>
							<th class="text-right" style="width:120px;">Vl Total</th>
						</tr>
					</thead>
					<tbody>
						<?php
							foreach($pedido["itens"] as $ped_item){
						?>
						<tr>
							<td>1</td>
							<td><?php echo $ped_item["geral"]->desc_item; ?></td>
							<td><?php echo $ped_item["geral"]->cod_tamanho; ?></td>
							<td><?php echo (int)$ped_item["geral"]->qtd_item; ?></td>
							<td class="text-right">R$ <?php echo number_format((float)$ped_item["geral"]->preco_unitario, 2, ',', ''); ?></td>
							<td class="text-right">R$ <?php echo number_format((float)$ped_item["geral"]->subtotal_item, 2, ',', ''); ?></td>
						</tr>
						<?php
							if(count($ped_item["adicionais"]) > 0){
						?>
						<tr style="font-size:10px; font-weight:bold;">
							<td style="border-top:0; " colspan="6">Adicionais</td>
						</tr>
						<?php
							foreach($ped_item["adicionais"] as $adicional){
						?>
						<tr style="border-top:0;">
							<td style="border-top:0; padding-top:0; font-size:12px;" colspan="4"><?php echo $adicional->desc_ingrediente; ?></td>
							<td style="border-top:0; padding-top:0; font-size:12px;" class="text-right">R$ <?php echo number_format((float)$adicional->preco_unitario, 2, ',', ''); ?></td>
							<td style="border-top:0; padding-top:0; font-size:12px;" class="text-right">R$ <?php echo number_format((float)$adicional->subtotal_adic, 2, ',', ''); ?></td>
						</tr>
						<?php
							}

							}
						?>
						<?php
							}
						?>
					</tbody>
					<tfooter>
						<tr>
							<td colspan="5">
								<strong>Total</strong>
							</td>
							<td class="text-right"><strong>R$ <?php echo number_format((float)$pedido["geral"]->pedido_total_itens, 2, ',', ''); ?></strong></td>
						</tr>
					</tfooter>
				</table>
				</div>
			</div>


			<div class="panel panel-default">
				<div class="panel-heading">Local de entrega</div>
				<div class="panel-body">
					<strong><?php echo $pedido["geral"]->cliente_nome . ' - '. $pedido["geral"]->local_desc; ?></strong>
					<?php 
						echo br();
						echo $pedido["geral"]->local_endereco . ', ' . $pedido["geral"]->local_numero . ' - ' . $pedido["geral"]->local_bairro;
						echo br();
						echo "CEP " . UDUtil::mask($pedido["geral"]->local_cep, "##.###-###");
						if(!empty($pedido["geral"]->local_obs)){
							echo br() . br();
							echo "<i>Observações:</i> " . $pedido["geral"]->local_obs;
						}
					?>
				</div>
			</div>			

		</div>
	</div>
</div>


